<template>
  <div class="vehicle-info-dialog">
    <header>车辆信息</header>
    <div class="info-item" v-for="(item, index) in infoList" :key="index">
      <div class="label">{{item.label}}：</div>
      <div class="value">
        <template v-if="Object.prototype.toString.call(item.value) === '[object Array]'">
          <div class="value-item" v-for="(value, order) in item.value" :key="order">
            <div class="content">{{value}}</div>
            <div class="icon" v-if="item.hasOwnProperty('icon')">
              <img :src="item.icon" alt="图标" />
            </div>
          </div>
        </template>
        <div class="value-item" v-else>
          <div class="content">{{item.value}}</div>
          <div class="icon" v-if="item.hasOwnProperty('icon')">
            <img :src="item.icon" alt="图标" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
@Component({
  name: 'vehicle-info-dialog'
})

export default class VehicleInfoDialog extends Vue {
  private infoList: any[] = [
    { label: '线路名称', value: '南宁-柳州线' },
    { label: '车牌号', value: '桂A56203' },
    { label: '所属公司', value: '白马市长途客运公司' },
    { label: '司机姓名', value: '王德凯' },
    { label: '联系方式', value: '16636202303' },
    { label: '载客数量', value: '35人' },
    { label: '时速', value: '40km/h' },
    { label: '始发站', value: '南宁站' },
    { label: '途径站', value: '玉林、防城港' },
    { label: '下站一站', value: '柳州站(1小时)', icon: require('assets/images/situational-awareness/dingwei.png') },
    { label: '车载监控', value: ['人脸识别监控1', '人间识别监控2', '人间识别监控3'], icon: require('assets/images/situational-awareness/jiankong.png') }
  ]
}
</script>

<style lang="scss" scoped>
img {
  width: 100%;
  height: 100%;
  float: left;
}
.vehicle-info-dialog {
  min-width: 294px;
  background: rgba(1, 19, 67, 1);
  border-radius: 8px;
  border: 2px solid #037ddc;
  box-shadow: 0px 0px 10px 2px #037ddc;
  box-sizing: border-box;
  padding: 4px 18px 18px;
  position: absolute;
  z-index: 100;
  top: 40%;
  left: 24%;
  header {
    height: 54px;
    line-height: 54px;
    font-size: 20px;
    font-family: 'PingFang Regular';
    font-weight: bold;
    color: #fff;
  }
  .info-item {
    width: 100%;
    display: flex;
    box-sizing: border-box;
    padding-left: 18px;
    position: relative;
    &::before {
      content: '';
      position: absolute;
      width: 8px;
      height: 8px;
      background: #0c81fe;
      border-radius: 50%;
      left: 0px;
      top: 9px;
    }
    .label {
      font-size: 14px;
      font-family: 'PingFang Regular';
      color: #fff;
      height: 26px;
      line-height: 26px;
    }
    .value {
      &-item {
        display: flex;
        align-items: center;
        .content {
          font-size: 14px;
          font-family: 'PingFang Regular';
          color: #fff;
          height: 26px;
          line-height: 26px;
        }
        .icon {
          width: 16px;
          height: 16px;
          margin-left: 10px;
        }
      }
    }
  }
}
</style>
